package com.minimalist.common.feign.client.lindi;

import com.minimalist.common.config.mybatis.bo.PageResp;
import com.minimalist.common.entity.lindi.vo.indexchangerecord.LindiIndexChangeRecordQueryVO;
import com.minimalist.common.entity.lindi.vo.indexchangerecord.LindiIndexChangeRecordVO;
import com.minimalist.common.feign.config.FeignConfig;
import com.minimalist.common.feign.fallback.lindi.LindiIndexChangeRecordFeignClientFallbackFactory;
import com.minimalist.common.response.R;
import com.minimalist.common.utils.Add;
import com.minimalist.common.utils.Update;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import jakarta.validation.constraints.NotNull;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 林地指标变更记录 Feign 客户端
 *
 * @author 11987
 */
@FeignClient(name = "minimalist-lindi"
        , contextId = "lindiIndexChangeRecordFeignClient"
        , path = "/minimalist/lindi/indexChangeRecord"
        , configuration = FeignConfig.class
        , fallbackFactory = LindiIndexChangeRecordFeignClientFallbackFactory.class)
public interface LindiIndexChangeRecordFeignClient{
    /**
     * 添加指标变更记录
     *
     * @param recordVO 指标变更记录信息
     * @return 成功或失败
     */
    @PostMapping("/addIndexChangeRecord")
    @Operation(summary = "添加指标变更记录")
    R<?> addIndexChangeRecord(
            @RequestBody @Validated(Add.class) LindiIndexChangeRecordVO recordVO);

    /**
     * 删除指标变更记录 -> 根据记录ID删除
     *
     * @param indexChangeRecordId 记录ID
     * @return 成功或失败
     */
    @DeleteMapping("/deleteIndexChangeRecordByIndexChangeRecordId")
    @Operation(summary = "删除指标变更记录 -> 根据记录ID删除")
    R<?> deleteIndexChangeRecordByIndexChangeRecordId(
            @RequestParam("indexChangeRecordId")
            @NotNull(message = "记录ID不能为空")
            @Parameter(name = "indexChangeRecordId", required = true, description = "记录ID")
            Long indexChangeRecordId);

    /**
     * 修改指标变更记录
     *
     * @param recordVO 指标变更记录信息
     * @return 成功或失败
     */
    @PutMapping("/updateIndexChangeRecordByIndexChangeRecordId")
    @Operation(summary = "修改指标变更记录")
    R<?> updateIndexChangeRecordByIndexChangeRecordId(
            @RequestBody @Validated(Update.class) LindiIndexChangeRecordVO recordVO);

    /**
     * 查询指标变更记录列表(分页)
     *
     * @param queryVO 查询条件
     * @return 指标变更记录列表
     */
    @GetMapping("/getPageIndexChangeRecordList")
    @Operation(summary = "查询指标变更记录列表(分页)")
    R<PageResp<LindiIndexChangeRecordVO>> getPageIndexChangeRecordList(
            @SpringQueryMap LindiIndexChangeRecordQueryVO queryVO);

    /**
     * 根据记录ID查询指标变更记录
     *
     * @param indexChangeRecordId 记录ID
     * @return 指标变更记录
     */
    @GetMapping("/getIndexChangeRecordByIndexChangeRecordId/{indexChangeRecordId}")
    @Operation(summary = "根据记录ID查询指标变更记录")
    R<LindiIndexChangeRecordVO> getIndexChangeRecordByIndexChangeRecordId(
            @PathVariable(value = "indexChangeRecordId")
            @NotNull(message = "记录ID不能为空")
            @Parameter(name = "indexChangeRecordId", description = "记录ID", required = true)
            Long indexChangeRecordId);
}